<?php
$this->title = "发布帖子";
?>
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use common\models\Category;
use kartik\widgets\Select2;
use common\WuMing;
use yii\widgets\Pjax;

/* @var $this yii\web\View */
/* @var $model frontend\models\Post */
/* @var $form yii\widgets\ActiveForm */
?>

    <div class="main  pd20 mb20  post-create">
        <div role="tabpanel">

            <!-- Nav tabs -->
            <ul class="nav nav-tabs" role="tablist">
                <li role="presentation" class="active"><a
                        href="<?= Yii::$app->urlManager->createUrl("post/article") ?>">帖子</a></li>
                <li role="presentation"><a href="<?= Yii::$app->urlManager->createUrl("post/pic") ?>">图片</a></li>
                <li role="presentation"><a href="<?= Yii::$app->urlManager->createUrl("post/url") ?>">链接</a></li>
            </ul>

            <!-- Tab panes -->
            <div class="tab-content">
                <div role="tabpanel" class="tab-pane active" id="home">
                    <div class="post-form">

                        <?php $form = ActiveForm::begin(); ?>

                        <?= $form->field($model, 'title')->textInput(['maxlength' => 100, 'placeholder' => '请输入帖子标题'])->label("") ?>

                        <script id="container" name="ArticleForm[content]"></script>

                        <div class="form-group">
                            <label for="">揭示板(必选)</label>
                            <div class="tagslist">
                                <?php $cates = WuMing::getUserCategory(Yii::$app->user->id, false) ?>
                                <?php foreach($cates as $v):?>
                                    <span class="list-tag" data-id="<?=$v['id']?>"><?=$v['name']?></span>
                                <?php endforeach;?>
                            </div>
                        </div>
                        <?= $form->field($model, 'cid1')->hiddenInput(['class'=>'cate-cid'])->label(false) ?>

                        <div class="clearfix"></div>
                        <div class="form-group">
                            <?= Html::submitButton('发布帖子', ['class' => 'btn btn-primary']) ?>
                        </div>

                        <?php ActiveForm::end(); ?>

                    </div>

                </div>

            </div>

        </div>
    </div>



<?php
$script = <<<UM
    jQuery(document).ready(function($) {
        var ue = UE.getEditor('container', {
            toolbars: [
            ['fullscreen', 'bold','italic','underline','strikethrough','justifyleft','justifyright','justifycenter','insertunorderedlist','insertorderedlist', 'spechars', 'emotion','insertimage','insertvideo','music','insertcode','fontfamily', ]
            ],
            initialFrameHeight:400,
            enableAutoSave: true,
            saveInterval: 60000
        });
        ue.ready(function() {
            //设置编辑器的内容
          //  ue.setContent('请输入帖子内容');
        });


    });

UM;
$this->registerJs($script);
?>
